bitkeeper revision 1.1338.1.1 (42665262XHUfWrT775PaPvnAkL5qXg)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 20 Apr 2005 13:00:18 +0000 (13:00 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 20 Apr 2005 13:00:18 +0000 (13:00 +0000)
Fix assumption about size of irq_cpustat_t in assembly code.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/x86_32/asm-offsets.c
xen/arch/x86/x86_32/entry.S
xen/arch/x86/x86_64/asm-offsets.c
xen/arch/x86/x86_64/entry.S
xen/include/asm-x86/config.h

index ee605b947138b038d91248009fb7d456c4cfcf34..1a16ab21110bf92778304f157b871228d3db9e99 100644 (file)
 #define OFFSET(_sym, _str, _mem) \
     DEFINE(_sym, offsetof(_str, _mem));
 
+/* base-2 logarithm */
+#define __L2(_x)  (((_x) & 0x00000002) ?   1 : 0)
+#define __L4(_x)  (((_x) & 0x0000000c) ? ( 2 + __L2( (_x)>> 2)) : __L2( _x))
+#define __L8(_x)  (((_x) & 0x000000f0) ? ( 4 + __L4( (_x)>> 4)) : __L4( _x))
+#define __L16(_x) (((_x) & 0x0000ff00) ? ( 8 + __L8( (_x)>> 8)) : __L8( _x))
+#define LOG_2(_x) (((_x) & 0xffff0000) ? (16 + __L16((_x)>>16)) : __L16(_x))
+
 void __dummy__(void)
 {
     OFFSET(XREGS_eax, struct xen_regs, eax);
@@ -78,4 +85,7 @@ void __dummy__(void)
     BLANK();
 
     DEFINE(FIXMAP_apic_base, fix_to_virt(FIX_APIC_BASE));
+    BLANK();
+
+    DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t)));
 }
index c860e4893754c36e7542f4814ddf118ec684ce51..aa35590d276d2686e1553833e07f2a686489f68f 100644 (file)
@@ -140,7 +140,7 @@ vmx_test_all_events:
         cli                             # tests must not race interrupts
 /*test_softirqs:*/  
         movl EDOMAIN_processor(%ebx),%eax
-        shl  $6,%eax                    # sizeof(irq_cpustat) == 64
+        shl  $IRQSTAT_shift,%eax
         test %ecx,SYMBOL_NAME(irq_stat)(%eax,1)
         jnz  vmx_process_softirqs
 
@@ -270,7 +270,7 @@ test_all_events:
         cli                             # tests must not race interrupts
 /*test_softirqs:*/  
         movl EDOMAIN_processor(%ebx),%eax
-        shl  $6,%eax                    # sizeof(irq_cpustat) == 64
+        shl  $IRQSTAT_shift,%eax
         test %ecx,SYMBOL_NAME(irq_stat)(%eax,1)
         jnz  process_softirqs
 /*test_guest_events:*/
index d05bb2b7aff2e8d193e142d480cdcf4ac7186c07..787c5ffea439665223a4b563c7182c51bbc8ab5b 100644 (file)
 #define OFFSET(_sym, _str, _mem) \
     DEFINE(_sym, offsetof(_str, _mem));
 
+/* base-2 logarithm */
+#define __L2(_x)  (((_x) & 0x00000002) ?   1 : 0)
+#define __L4(_x)  (((_x) & 0x0000000c) ? ( 2 + __L2( (_x)>> 2)) : __L2( _x))
+#define __L8(_x)  (((_x) & 0x000000f0) ? ( 4 + __L4( (_x)>> 4)) : __L4( _x))
+#define __L16(_x) (((_x) & 0x0000ff00) ? ( 8 + __L8( (_x)>> 8)) : __L8( _x))
+#define LOG_2(_x) (((_x) & 0xffff0000) ? (16 + __L16((_x)>>16)) : __L16(_x))
+
 void __dummy__(void)
 {
     OFFSET(XREGS_r15, struct xen_regs, r15);
@@ -77,4 +84,7 @@ void __dummy__(void)
     OFFSET(MULTICALL_arg3, multicall_entry_t, args[3]);
     OFFSET(MULTICALL_arg4, multicall_entry_t, args[4]);
     OFFSET(MULTICALL_result, multicall_entry_t, args[5]);
+    BLANK();
+
+    DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t)));
 }
index 9254cf76e4674309e13428f69abe88e1cb625b69..e6ee0e8fd37d9a1a6b9f1df3bdd68118654b229a 100644 (file)
@@ -130,7 +130,7 @@ test_all_events:
         cli                             # tests must not race interrupts
 /*test_softirqs:*/  
         movl  EDOMAIN_processor(%rbx),%eax
-        shl   $6,%rax                    # sizeof(irq_cpustat) == 64
+        shl   $IRQSTAT_shift,%rax
         leaq  SYMBOL_NAME(irq_stat)(%rip),%rcx
         testl $~0,(%rcx,%rax,1)
         jnz   process_softirqs
@@ -237,16 +237,13 @@ ENTRY(vmx_asm_do_resume)
 vmx_test_all_events:
         GET_CURRENT(%rbx)
 /* test_all_events: */
-        xorq %rcx,%rcx
-        notq %rcx
         cli                             # tests must not race interrupts
 /*test_softirqs:*/  
-        movq EDOMAIN_processor(%rbx),%rax
-#if 0
-        shl  $6,%rax                    # sizeof(irq_cpustat) == 64
-        test %rcx,SYMBOL_NAME(irq_stat)(%rax,1)
-#endif
-        jnz  vmx_process_softirqs
+        movl  EDOMAIN_processor(%rbx),%eax
+        shl   $IRQSTAT_shift,%rax
+        leaq  SYMBOL_NAME(irq_stat)(%rip), %rdx
+        testl $~0,(%rdx,%rax,1)
+        jnz   vmx_process_softirqs
 
 vmx_restore_all_guest:
         call SYMBOL_NAME(load_cr2)
index 2b20297a6ea56c0994edaf71f0a9cf802f08ef99..015e79022ad6483bed15b615b5eeb4e2f2fa4bb7 100644 (file)
@@ -16,7 +16,9 @@
 #define CONFIG_X86_LOCAL_APIC 1
 #define CONFIG_X86_GOOD_APIC 1
 #define CONFIG_X86_IO_APIC 1
-#define CONFIG_X86_L1_CACHE_SHIFT 5
+
+/* Intel P4 currently has largest cache line (L2 line size is 128 bytes). */
+#define CONFIG_X86_L1_CACHE_SHIFT 7
 
 #define CONFIG_ACPI 1
 #define CONFIG_ACPI_BOOT 1
 
 #define OPT_CONSOLE_STR "com1,vga"
 
-/*
- * Just to keep compiler happy.
- * NB. DO NOT CHANGE SMP_CACHE_BYTES WITHOUT FIXING arch/i386/entry.S!!!
- * It depends on size of irq_cpustat_t, for example, being 64 bytes. :-)
- */
-#define SMP_CACHE_BYTES 64
 #define NR_CPUS 16
 
 /* Linkage for x86 */